<!DOCTYPE html>
<html lang="zh-CN">

<head>
	<meta charset="UTF-8" />
	<meta name="author" content="wangbo" />
	<meta http-equiv="X-UA-Compatible" content="IE=edge" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0" />
	<title>流程语句</title>
</head>

<body>
	<script>
		// 数组去重
		function arr_unique(arr) {
			//定义一个新数组,用于存放去重后的元素
			var newArr = [];
			for (i = 0; i < arr.length; i++) {
				//1-假设新数组中不存在当前元素
				var flag = false;
				for (var j = 0; j < newArr.length; j++) {
					//2-if条件一旦成立,说明我们的假设是错误的,所以立马否定我们的假设
					if (arr[i] == newArr[j]) {
						flag = true;
						break;
					}
				}
				//3-将flag为false的元素加入新数组中并返回
				if (flag == false) {
					newArr[newArr.length] = arr[i];
				}
			}
			return newArr;
		}

	</script>
</body>

</html>